//////////////////////////////////////////////////////////////////////////

#ifndef _NETWORK_PACKETS_H_
#define _NETWORK_PACKETS_H_

//////////////////////////////////////////////////////////////////////////

#include <queue>
#include <list>
#include <string>
#include <vector>

//////////////////////////////////////////////////////////////////////////

#include "common_types.h"

//////////////////////////////////////////////////////////////////////////


/** Network packet, that is sent by client to server
*
*  @author   Roman Pasechnik
*  @since    Jun 04th, 2009
*  @updated  Jun 12th, 2009
*/
struct ClientPacket
{
//////////////////////////////////////////////////////////////////////////

    unsigned int m_KeyFlags;
    STM::ScrPosition m_MousePosition;

    void FromStr( const char* _str );
    std::vector<char> ToStr() const;

    bool operator==( const ClientPacket& _rhs );
    bool operator!=( const ClientPacket& _rhs );

    int Size() const;


//////////////////////////////////////////////////////////////////////////
};


/** Network packet, that is sent by server to client
*
*  @author   Roman Pasechnik
*  @since    Jun 04th, 2009
*  @updated  Jun 12th, 2009
*/
struct ServerPacket
{
//////////////////////////////////////////////////////////////////////////

    STM::ScrPositions m_Players;
    STM::ScrPositions m_Bullets;

    void FromStr( const char* _str );
    std::vector<char> ToStr() const;

    bool operator==( const ServerPacket& _rhs );
    bool operator!=( const ServerPacket& _rhs );

    int Size() const;

//////////////////////////////////////////////////////////////////////////
};

typedef std::queue<ClientPacket> ClientPackets;
typedef std::list<ClientPackets> ClientsPackets;

typedef std::queue<ServerPacket> ServerPackets;
typedef std::list<ServerPacket> ServersPackets;


//////////////////////////////////////////////////////////////////////////

#endif

//////////////////////////////////////////////////////////////////////////
